# Geometry: Contextual ```{eval-rst} .. py:function:: Geometry(EntityName) :nocontentsentry: Obtains an entity given its name :param str EntityName: Entity name. ``` ```{eval-rst} .. py:function:: GeometryModelGroup(GroupName) :nocontentsentry: Obtains a group given its name :param str GroupName: Group name. ``` ```{eval-rst} .. py:function:: geomExplode(entity, Geom) :nocontentsentry: Explode: Explode the selected geometry in order to its components are editable | Alias: explode :param [Entity] entity: Entity/Entities to apply the command :param Enumerate: { VERTEX, EDGE, WIRE, FACE, SHELL, VOLUME, BODY, GROUP, ENTITY } Geom: Sub-Geom: Topology of the geometry entities. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Exploding a geometric entity into its sub-elements # This command decomposes a geometric entity into its constituent # sub-geometries (e.g., vertices, edges, or faces). # # The second argument determines the type of subgeometry to extract: # - "VERTEX" : Extracts the corner points of the geometry. # - "EDGE" : Extracts the boundary curves. # - "WIRE" : Extracts the groups of curves. # - "FACE" : Extracts the surface faces. # - "SHELL" : Extracts the shells. # - "VOLUME" : Extracts the volumes. # # The result is a list of new geometric entities representing the # requested sub-elements. # Create a sample surface (quadrilateral) to work with quad_geom_entity = createQuad( "Surface", Point(0, 0, 0), Point(1, 0, 0), Point(1, 1, 0), Point(0, 1, 0) ) # Explode the surface into its vertices sub_geoms = geomExplode([quad_geom_entity], "VERTEX") # Result: # sub_geoms is a list of point entities corresponding to the four vertices # of the quadrilateral surface. ``` ```{eval-rst} .. py:function:: mirror(entity, Axis) :nocontentsentry: Axis: Axial reflection of the geometric entity :param [Entity] entity: Entity/Entities to apply the command :param POCCGeomLine Axis: Axis: Axis of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, Pnt) :nocontentsentry: Axis: Axial reflection of the geometric entity :param [Entity] entity: Entity/Entities to apply the command :param POCCVertexByCoord Pnt: Point: Point of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, GeomName, Axis) :nocontentsentry: Axis: Axial reflection of the geometric entity :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCGeomLine Axis: Axis: Axis of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, Copy, Plane) :nocontentsentry: Axis: Axial reflection of the geometric entity | Constraints: 3 dimensions :param [Entity] entity: Entity/Entities to apply the command :param bool Copy: Copy: Create a copy of the geometry. :param POCCQuad Plane: Plane: Plane of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, GeomName, Pnt) :nocontentsentry: Axis: Axial reflection of the geometric entity :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCVertexByCoord Pnt: Point: Point of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, Copy, GeomName, Plane) :nocontentsentry: Plane: Reflection through a plane of the geometric entity | Constraints: 3 dimensions :param [Entity] entity: Entity/Entities to apply the command :param bool Copy: Copy: Create a copy of the geometry. :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCQuad Plane: Plane: Plane of symmetry. Conditions: The input must be non-empty. "" does not exist in the dropdown list. ``` ```{eval-rst} .. py:function:: mirror(entity, Copy, PointPlane, VectorPlane) :nocontentsentry: Plane: Reflection through a plane of the geometric entity | Constraints: 3 dimensions :param [Entity] entity: Entity/Entities to apply the command :param bool Copy: Copy: Create a copy of the geometry. :param PointPlane: Point of plane: Point of the plane of symmetry. :param VectorPlane: Normal vector of plane: Normal vector of the plane of symmetry. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Mirroring a geometric entity about an axis # In this example, a geometric entity (an axis) is duplicated by mirroring it # with respect to another axis that acts as the mirror plane. # --- Create the entity to be mirrored --- origin = Point(1, 0, 0) # Origin point of the axis to be copied direction = Vector(1, 0, 0) # Direction vector of the axis to be copied geom_entity_to_copy = createAxis( "Curve", # Name of the original axis entity origin, # Origin point direction # Axis direction ) # --- Create the mirror axis --- # This axis defines the position and orientation of the mirror plane. origin = Point(0, 0, 0) # Origin point of the mirror axis direction = Vector(1, 0, 0) # Direction vector of the mirror axis axis_mirror_geom_entity = createAxis( "Curve (mirror)", # Name of the mirror axis entity origin, # Origin point direction # Axis direction ) # --- Perform the mirror operation --- # The 'mirror' command creates a mirrored copy of the specified entity # with respect to the given axis. mirror( [geom_entity_to_copy], # List of entities to mirror "Copy of Curve", # Name of the mirrored entity axis_mirror_geom_entity # Axis used as the mirror reference ) ``` ```{eval-rst} .. py:function:: move(entity, FirstPoint, SecondPoint) :nocontentsentry: Point to point: Translate the geometric entity from one point to another :param [Entity] entity: Entity/Entities to apply the command :param Entity FirstPoint: Point1: First point of translation vector. Conditions: The input must be non-empty. "" does not exist in the dropdown list. Points can not match. :param Entity SecondPoint: Point2: Second point of translation vector. Conditions: The input must be non-empty. "" does not exist in the dropdown list. Points can not match. ``` ```{eval-rst} .. py:function:: move(entity, GeomName, FirstPoint, SecondPoint) :nocontentsentry: Point to point: Translate the geometric entity from one point to another :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param Entity FirstPoint: Point1: First point of translation vector. Conditions: The input must be non-empty. "" does not exist in the dropdown list. Points can not match. :param Entity SecondPoint: Point2: Second point of translation vector. Conditions: The input must be non-empty. "" does not exist in the dropdown list. Points can not match. ``` ```{eval-rst} .. py:function:: move(entity, DX, DY, DZ) :nocontentsentry: Point to point: Translate the geometric entity from one point to another :param [Entity] entity: Entity/Entities to apply the command :param Double DX: DX: X component of translation vector. :param Double DY: DY: Y component of translation vector. :param Double DZ: DZ: Z component of translation vector. ``` ```{eval-rst} .. py:function:: move(entity, Copy, Independent, DX, DY, DZ) :nocontentsentry: Vector: Translate the geometric entity following a vector :param [Entity] entity: Entity/Entities to apply the command :param bool Copy: Copy: Create a copy of the geometry. :param bool Independent: Independent: Create a copy not referenced to current geometric entity. :param Double DX: DX: X component of translation vector. :param Double DY: DY: Y component of translation vector. :param Double DZ: DZ: Z component of translation vector. ``` ```{eval-rst} .. py:function:: move(entity, GeomName, Copy, Independent, DX, DY, DZ) :nocontentsentry: Vector: Translate the geometric entity following a vector :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param bool Copy: Copy: Create a copy of the geometry. :param bool Independent: Independent: Create a copy not referenced to current geometric entity. :param Double DX: DX: X component of translation vector. :param Double DY: DY: Y component of translation vector. :param Double DZ: DZ: Z component of translation vector. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Moving a geometric entity from one point to another # This command creates a copy of a geometric entity translated from a starting point # to an end point. The original entity remains unchanged, and a new entity is generated # with the specified translation. # Create the geometry to move (e.g., a quad surface) object_geom_entity = createQuad( "Surface", Point(0, 0, 0), Point(1, 0, 0), Point(1, 1, 0), Point(0, 1, 0) ) # Define the starting point of the translation starting_point_geom_entity = createPoint("Point", Point(0, 0, 0)) # Define the end point of the translation end_point_geom_entity = createPoint("Point (2)", Point(0, 0, 1)) # Perform the translation operation move( [object_geom_entity], # List of entities to move "Copy of Surface", # Name of the resulting moved entity starting_point_geom_entity, # Starting point of the translation end_point_geom_entity # End point of the translation ) # Result: # A copy of the original quad surface is created, moved from the starting point # to the end point. The original entity remains unchanged. ``` ```{eval-rst} .. py:function:: multiRotation(entity, Axis, Angle, NumTimes) :nocontentsentry: Multiple copy: Creates multiple copies rotating the geometric entity | Alias: multiR :param [Entity] entity: Entity/Entities to apply the command :param Entity Axis: Axis: Axis of rotation. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double Angle: Angle: Angle of rotation. Conditions: Value must be greater than 0. :param int NumTimes: Rotations: Number of times that the geometric entity will be rotated. Conditions: Value must be greater than 0. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Rotating a geometry multiple times around an axis # This command performs one or multiple rotations of a given geometry # around a specified axis by a defined angle. It can be used to create # repeated patterns or symmetrical geometries through rotational duplication. # Arguments: # 1. List: Entities to rotate (e.g., surfaces, curves, solids). # 2. Axis entity: The geometric axis used as the center of rotation. # 3. Double: Rotation angle in degrees for each step. # 4. Integer: Number of rotations to apply. # Geometry to rotate quad_geom_entity = createQuad( "Surface", Point(0, 0, 0), Point(1, 0, 0), Point(1, 1, 0), Point(0, 1, 0) ) # Axis of rotation axis_geom_entity = createAxis("Curve", Point(0, 0, 0), Vector(1, 0, 0)) # Rotation parameters rotAngle = Double(90) # Rotation angle per instance (in degrees) num_rotations = 1 # Number of rotations or instances to generate # Execute the multi-rotation multiRotation( [quad_geom_entity], axis_geom_entity, rotAngle, num_rotations ) # Result: # A rotated copy (or multiple copies) of the original geometry is created # around the specified axis, according to the given rotation angle and count. ``` ```{eval-rst} .. py:function:: multiTranslate(entity, DirU, NumTimesDirU, Independent) :nocontentsentry: Multiple copy: Creates multiple copies traslating the geometric entity | Alias: multiTr :param [Entity] entity: Entity/Entities to apply the command :param Vector DirU: Vector 1: First vector to define the translation. Conditions: A vector cannot have zero magnitude. :param int NumTimesDirU: Number 1: Number of translations to be done along the first direction. Conditions: Value must be greater than 0. :param bool Independent: Independent: Create a copy not referenced to current geometric entity. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Performing multiple translations of a geometry along a single direction # This command creates multiple translated copies of a given geometry # along a specified direction vector. It can optionally create independent # entities, meaning the new copies are not linked to the original geometry. # Arguments: # 1. List: Entities to translate (e.g., surfaces, solids). # 2. Vector: Direction vector defining the translation path. # 3. Integer: Number of translations to perform. # 4. Boolean: Whether to make the new entities independent from the original. # Geometry to translate box_geom_entity = createBox( "Volume", Point(0, 0, 0), Double(1), Double(1), Double(1) ) # Translation parameters direction = Vector(1, 0, 0) # Direction of translation num_translations = 1 # Number of translated copies independent = True # If True, creates independent entities # Execute the multiple translations multiTranslate( [box_geom_entity], direction, num_translations, independent ) # Result: # The original geometry is duplicated the specified number of times # along the given direction. If 'independent' is True, the resulting # geometries are not linked to the original one. ``` ```{eval-rst} .. py:function:: rotate(entity, Axis, Angle) :nocontentsentry: Rotate: Rotate the geometric entity around an axis | Constraints: 3 dimensions :param [Entity] entity: Entity/Entities to apply the command :param POCCGeomLine Axis: Axis: Axis of rotation. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double Angle: Angle: Angle of rotation. ``` ```{eval-rst} .. py:function:: rotate(entity, Center, Angle) :nocontentsentry: Rotate: Rotate the geometric entity around an axis | Constraints: 2 dimensions :param [Entity] entity: Entity/Entities to apply the command :param Point Center: Central point: Central point of rotation. :param Double Angle: Angle: Angle of rotation. ``` ```{eval-rst} .. py:function:: rotate(entity, GeomName, Axis, Angle) :nocontentsentry: Rotate: Rotate the geometric entity around an axis | Constraints: 3 dimensions :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCGeomLine Axis: Axis: Axis of rotation. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double Angle: Angle: Angle of rotation. ``` ```{eval-rst} .. py:function:: rotate(entity, GeomName, Center, Angle) :nocontentsentry: Rotate: Rotate the geometric entity around an axis | Constraints: 2 dimensions :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param Point Center: Central point: Central point of rotation. :param Double Angle: Angle: Angle of rotation. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Rotating a geometric entity around an axis # This command performs a rotation of one or more geometric entities # around a specified axis. The rotation is defined by an angle. # The command does not have referenced/non-referenced modes, since the entities # themselves are directly provided. # Define the rotation angle rotation_angle = Double(180) # Rotation angle in degrees # Create the entity to be rotated (example: a quad) quad_geom_entity = createQuad( "Surface", Point(0, 0, 0), Point(1, 0, 0), Point(1, 1, 0), Point(0, 1, 0) ) # Define the rotation axis axis_rotation_geom_entity = createAxis( "Curve", Point(0, 0, 0), # Axis origin Vector(1, 0, 0) # Axis direction ) # Perform the rotation rotate( [quad_geom_entity], # List of entities to rotate "Copy of Surface", # Name of the resulting rotated entity axis_rotation_geom_entity, # Axis entity around which to rotate rotation_angle # Rotation angle in degrees ) # Result: # A copy of the original quad is created, rotated around the specified axis # by the defined angle. ``` ```{eval-rst} .. py:function:: scale(entity, Center, Factor) :nocontentsentry: Proportional: Scale the geometric entity proportionally in all its dimensions :param [Entity] entity: Entity/Entities to apply the command :param POCCVertexByCoord Center: Central point: Central point of scale. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double Factor: Factor: Scale factor. Conditions: Value must be greater than 0. ``` ```{eval-rst} .. py:function:: scale(entity, GeomName, Center, Factor) :nocontentsentry: Proportional: Scale the geometric entity proportionally in all its dimensions :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCVertexByCoord Center: Central point: Central point of scale. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double Factor: Factor: Scale factor. Conditions: Value must be greater than 0. ``` ```{eval-rst} .. py:function:: scale(entity, Center, FactorX, FactorY, FactorZ) :nocontentsentry: Non Proportional: Scale the geometric entity with different scale factors for each of its dimensions :param [Entity] entity: Entity/Entities to apply the command :param POCCVertexByCoord Center: Central point: Central point of scale. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double FactorX: Factor X: Scale factor in X direction. Conditions: Value must be greater than 0. :param Double FactorY: Factor Y: Scale factor in Y direction. Conditions: Value must be greater than 0. :param Double FactorZ: Factor Z: Scale factor in Z direction. Conditions: Value must be greater than 0. ``` ```{eval-rst} .. py:function:: scale(entity, GeomName, Center, FactorX, FactorY, FactorZ) :nocontentsentry: Non Proportional: Scale the geometric entity with different scale factors for each of its dimensions :param [Entity] entity: Entity/Entities to apply the command :param str GeomName: Name. Conditions: "" input must be non-empty. :param POCCVertexByCoord Center: Central point: Central point of scale. Conditions: The input must be non-empty. "" does not exist in the dropdown list. :param Double FactorX: Factor X: Scale factor in X direction. Conditions: Value must be greater than 0. :param Double FactorY: Factor Y: Scale factor in Y direction. Conditions: Value must be greater than 0. :param Double FactorZ: Factor Z: Scale factor in Z direction. Conditions: Value must be greater than 0. ``` *Example:* ```{code-block} python # -*- coding: utf-8 -*- # Example: Scaling a geometric entity # This command creates a scaled copy of one or more geometric entities. # The scaling is performed relative to a specified center point, using # a scale factor. The command does not have referenced/non-referenced modes. # Define the scale factor scale_factor = 1 # Factor by which the geometry is scaled (1 = no change) # Create the geometry to be scaled (example: a quad) object_geom_entity = createQuad( "Surface", Point(0, 0, 0), Point(1, 0, 0), Point(1, 1, 0), Point(0, 1, 0) ) # Define the center point for scaling center_scale_point_geom_entity = createPoint( "Point", Point(0, -2, 0) ) # Perform the scaling scale( [object_geom_entity], # List of entities to scale "Copy of Surface", # Name of the resulting scaled entity center_scale_point_geom_entity, # Center point of the scaling operation scale_factor # Scale factor ) # Result: # A copy of the original geometry is created, scaled by the specified factor # relative to the given center point. ```